home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
program
/
ny_src.zip
/
NY2008.H
< prev
next >
Wrap
C/C++ Source or Header
|
1997-04-22
|
15KB
|
526 lines
// 0 - Critical Door error (no fossil, etc.)
// 1 - Carrier lost, user off-line
// 2 - Sysop terminated call, user off-line
// 3 - User time used up, user STILL ON-LINE
// 4 - Keyboard inactivity timeout, user off-line
// 10 - User chose to return to BBS
// 11 - User chose to logoff, user off-line
// 12 - Critical RAVote error
#ifndef TRUE
#define FALSE 0
#define TRUE !FALSE
#endif
#include <process.h>
#include <math.h>
#include <dos.h>
#include <dirent.h>
#ifdef __TURBOC__
#include <dir.h>
#endif
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <errno.h>
#include <ctype.h>
#include <share.h>
#include <conio.h>
#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>
#ifdef __TURBOC__
#include <locking.h>
#endif
#ifdef __WATCOMC__
#include <malloc.h>
#endif
#include <limits.h>
#ifndef __BEEN_HERE__
//I never did an OS2 port .. although i started on it
#ifndef __OS2__
#include "\odoors\opendoor.h" // Must be included in all doors
#else
#include "\os2port\opendoor.h" // Must be included in all doors
#endif
#endif
#define __BEEN_HERE__
#define USER_FILENAME "NY2008.USR"
#define SCR_FILENAME "NY2008.SCR"
#define KEY_FILENAME "NYREG.KEY"
#define CFG_FILENAME "NY2008.CFG"
#define MAIL_FILENAME "NY2008.MSG"
#define MAIL_INDEX "NY2008.MSX"
#define ENEMY_FILENAME "NYENM.DAT"
#define ENEMY_INDEX "NYENM.IDX"
#define MAX_USERS 30000
#define FILE_ACCESS_MAX_WAIT 40
#define LEVELS 21
#define PROG_NAME_CHARS 35
#define PATH_CHARS 80
#define FILENAME_CHARS 12
#define MESSAGE_SUBJECT "##NY2008 v0.10 IBBS Door Message"
#define MESSAGE_PID "\1PID: ODIBMS 1\r"
#define MAX_LINE_LENGTH 70
#define MESSAGE_HEADER "$"
#define MESSAGE_FOOTER "$"
#define DELIMITER_CHAR '$'
#define NODE_ADDRESS_CHARS 23
#define SYSTEM_NAME_CHARS 40
#define LOCATION_CHARS 40
typedef enum {HANDS,
PEPPER,
KNIFE,
CHAIN,
GUN,
RIFLE,
LASER_GUN,
SHOTGUN,
MACHINEGUN,
GRANADE_LAUNCHER,
BLASTER,
A_BOMB,
SHARP_STICK,
SCREWDRIVER,
HAMMER,
LEAD_PIPE,
COLT,
ELEPHANT_GUN,
NAILGUN,
ASSAULT_RIFLE,
PROTON_GUN,
NEUTRON_PHASER,
ULTRASOUND_GUN} weapon;
typedef enum {POT,HASH,LSD,COKE,PCP,HEROIN} drug_type;
typedef enum {MALE,FEMALE} sex_type;
typedef enum {HEADBANGER,HIPPIE,BIG_FAT_DUDE,CRACK_ADDICT,PUNK} guy_type;
typedef enum {NONE,CRAPS,HERPES,SYPHILIS,AIDS} desease;
typedef enum {ALIVE,UNCONCIOUS,DEAD} guy_status;
typedef enum {NOWHERE,MOTEL,REG_HOTEL,EXP_HOTEL} hotel_type;
typedef enum {CENTRAL_PARK,CENTRAL_PARK_IB,EVIL_STUFF,BANK,HEALING,FOOD,
DRUGS,ARMS,SEX,MAIL,REST,P_FIG,C_FIG,S_FIG,ENTRY_1,ENTRY_2,
ONLINE,NEWZ,LIST,CONSIOUS,ATTACK,WIN,MAINT_RUN,WEAPONS,COPS,
NEW,NATION,OTHER,NEW_NAME,NEW_WIN,NEW_LOOSE,TEN_BEST,BUSTED,
ASS_KICKED,ASS_KICKED_P,ASS_KICKED_O,COLORS_HELP,CH_DRUG,
LIST_IB_SYS,IBBS_MENU,HITMEN,TEN_BEST_IBBS,END} menu_t;
/*#define NO_MAIL_FLAG 0x0001
#define NY2008_FALG2 0x0002
#define NY2008_FALG3 0x0004
#define NY2008_FALG4 0x0008
#define NY2008_FALG5 0x0010
#define NY2008_FALG6 0x0020*/
int main(int argc,char *argv[]); // Function prototype declarations
char entry_menu(void); // Menu draw...
//char central_park(void);
//char drugs(void);
//char money(void);
//char evil_stuff(void);
//char food(void);
//char guns(void);
//char get_laid(void);
//char healing(void);
//char mail(void);
char callmenu(char allowed[],menu_t menu,int menu_line,char figst);
void DisplayBestIB(void);
void read_IGMs(void);
unsigned long get_val(unsigned long def,unsigned long max);
void EnterStreet(void);
void ListPlayers(void);
void ListPlayersA(void);
void ListPlayersS(sex_type psex);
void DisplayStats(void);
void Maintanance(void);
void drug_ops(void);
void money_ops(void);
void get_laid_ops(void);
void food_ops(void);
void guns_ops(void);
void healing_ops(void);
void newz_ops(void);
void mail_ops(void);
void wrt_sts(void);
void exit_ops(void);
void SortScrFile(int usr, int max);
void ChangeOnlineRanks(void);
void WhosOnline(void);
int askifuser(char handle[25]);
char ny_get_answer(char *string);
void fig_ker(void);
void trim(char *numstr);
void dobadwords(char *s);
void print_drug(drug_type drug);
//void print_drug(drug_type drug,int len);
void print_arm(weapon arm);
void points_raise(unsigned long raise);
int CheckForHandle(char handle[25]);
void Die(int diecode); //die of reason 1=drugs 2=hunger 3=std
void ny_kernel(void);
//char rest(void);
void rest_ops(void);
void get_line(char beg[],char line[],char ovr[],int wrap);
void read_mail(void);
void illness(void);
void illness(desease ill, int inf, int rape=FALSE);
void news_post(char line[], char name1[], char name2[], int flag);
void print_disease(desease ill);
int seereg(char bbsname[]);
void get_bbsname(char bbsname[]);
//void cap_names(char name[]);
void change_info(void);
void dump(void);
int strzcmp(char str1[], char str2[]);
void del(char *file);
//void checknodes(void);
void WaitForEnter(void);
int ReadOrAddCurrentUser(void);
void WriteCurrentUser(void);
long randomf(long max);
//FILE *ExculsiveFileOpen(char *pszFileName, char *pszMode);
FILE *ShareFileOpen(char *pszFileName, char *pszMode);
size_t ny_fread(const void *ptr, size_t size, size_t n, FILE*stream);
size_t ny_fwrite(const void *ptr, size_t size, size_t n, FILE*stream);
void CustomConfigFunction(char *pszKeyword, char *pszOptions);
void strzcpy(char dest[],const char src[], int beg,int end);
double DrgPtsCoef(void);
void DisplayBest(void);
void AddBestPlayer(void);
void MakeFiles(void);
char *D_Num(int num);
char *D_Num(long num);
char *D_Num(unsigned long num);
void heal_wounds(void);
void take_drug(void);
void money_plus(unsigned long howmuch);
void money_minus(unsigned long howmuch);
void disp_fig_stats(void);
void SortScrFileB(int usr);
void points_loose(unsigned long lost);
void CrashRecovery(void);
void IGM(char exenam[]);
void IGM_ops(void);
void CreateDropFile(int all);
void ny_disp_emu(char line[]);
void nyr_disp_emu(char line[]);
void ny_clr_scr();
//void print_gun_prices(void);
void ny_disp_emu(char line[],int min);
void ny_disp_emu_file(FILE *ans_phile,FILE *asc_phile,char line[],int min);
char *ny_un_emu(char line[]);
char *ny_un_emu(char line[],char out[]);
void scr_save(void);
void scr_res(void);
void ch_game_d(void);
void ch_flag_d(void);
//void strim(char s[]);
void forrest_IGM(void);
void call_IGM(char exenamr[]);
void read_fight_IGMs(void);
FILE *ShareFileOpenAR(char *pszFileName, char *pszMode);
void UserStatus(void);
void ny_pers(unsigned char message);
void time_slice(void);
int copyfile(char *file1,char *file2);
int ny_remove(char *pszFileName);
void game_events(void);
void ny_stat_line(int line,int before,int after);
void ny_read_stat_line(int line,char *string, FILE *phile);
void read_ibmail(void);
char *LocationOf(char *address);
int ibbs_bbs_list(void);
void ibbs_bbs_name(int bbs,int sex,int nochoice,char nameI[],int *dbn,int *pn);
//char ibbs_m(void);
void ibbs_ops(void);
void AddBestPlayerIB(void);
void AddBestPlayerInIB(char *name, unsigned long points);
/*int findf(char *pathname, struct ffblk *ffblk, int attrib);
int fnext(struct ffblk *ffblk);
int strwcmp(char *format,char *string);*/
/*typedef struct {
int first_enemy[LEVELS],
last_enemy[LEVELS];
} enemy_idx;*/
typedef struct {
char sender[25];
char senderI[36];
sex_type sender_sex;
char n1;
char recver[25];
char recverI[36];
long location;
int afterquote;
int length;
int flirt;
desease ill;
char n2;
int inf;
int deleted;
} mail_idx_type;
/*typedef struct {
char sender[25];
char senderI[36];
sex_type sender_sex;
char node_s[NODE_ADDRESS_CHARS + 1];
char node_r[NODE_ADDRESS_CHARS + 1];
char recver[25];
char recverI[36];
int quote_length;
int length;
int flirt;
desease ill;
int inf;
int deleted;
} ibbs_mail_idx_type;*/
//defined in interbbs.h changed enum to char (as ibbs_mail_type_1)
typedef struct {
char sender[25];
char senderI[36];
sex_type sender_sex;
char node_s[NODE_ADDRESS_CHARS + 1];
char node_r[NODE_ADDRESS_CHARS + 1];
char recver[25];
char recverI[36];
char quote_length;
char length;
int flirt;
desease ill;
int inf;
char deleted;
char lines[20][81];
// char quote_lines[10][81];
} ibbs_mail_type;
typedef struct {
char name[25];
guy_type nation;
char n1;
int level;
unsigned long points;
guy_status alive;
char n2;
sex_type sex;
char n3;
int user_num,
online;
} scr_rec;
typedef struct {
char name[25];
char nameI[36];
guy_type nation;
int level;
unsigned long points;
sex_type sex;
} ibbs_scr_rec;
typedef struct {
char name[25];
char nameI[36];
guy_type nation;
int level;
unsigned long points;
sex_type sex;
char node[NODE_ADDRESS_CHARS + 1];
} ibbs_scr_spy_rec;
typedef struct {
char node[NODE_ADDRESS_CHARS + 1];
unsigned long hi_points;
} ibbs_bbs_rec;
typedef struct {
char node[NODE_ADDRESS_CHARS + 1];
unsigned long hi_points;
int players;
int player_list; //number of file with player list
} ibbs_bbs_spy_rec;
typedef struct {
int action;
char name_s[25];
char name_sI[36];
char name_r[25];
char name_rI[36];
char node_s[NODE_ADDRESS_CHARS + 1];
// unsigned long money;
char data[10];
} ibbs_act_rec;
/*actions:
0=name change name_sI change to name_s
1=spy on name_rI
*/
typedef struct {
char name[25];
unsigned long points;
} best_rec_type;
typedef struct {
char name[25];
unsigned long points;
char location[NODE_ADDRESS_CHARS + 1];
} ibbs_best_rec_type;
typedef struct {
char name[36];
long hitpoints,
strength,
defense;
weapon arm;
char n1;
} enemy;
//Player User File structure (beta6+)
typedef struct {
//character fields
char bbsname[36], //the BBS name of the user
name[25], //the name of the character
say_win[41], //what the user says when he wins
say_loose[41]; // " " " " " " looses
//integer records
int rank, //user rank
days_not_on, //days the user gas been inactive
strength, //attacking strenght of the user
defense, //defensive strenght
condoms, //condoms user has
since_got_laid, //days since the user last got laid
drug_hits, //the hist that the user has
drug_days_since; //if addicted how long the user
//has not used the drug
//long type records
long hitpoints, //users hitpoints
maxhitpoints; //maximum of the users hitpoints
//unsigned long type record
unsigned long points, //users points
money, //money in hand
bank; //money in bank
//unsigned char type records used as values
unsigned char level, //user level
turns, //fight the user has left today
hunger, // % of hunger
sex_today, //sex turns left today
std_percent, // % of current std
drug_addiction, // % of drug addiction
drug_high, // % of how "high" the player is
hotel_paid_fer, //for how many more days the hotel
//is paid for
days_in_hospital;//how many days has the use been
//in hospital
/*enumerated types stored as char!!! (not int)*/
guy_status alive; //user: alive, unconsious, or dead
sex_type sex; //user sex: Male, Female
guy_type nation; //what is he:
//punk, headbanger ...
weapon arm; //players weapon
desease std; //current player std
drug_type drug; //current player drug type
hotel_type rest_where; //where the user is staying lately
/*added values BETA 9*/
char wtc; //# of wtc bombings allowed per day
//default=1
char poison; //number of poisoning of watr allowed
//per day, default=1
/*added values v0.10*/
unsigned char rocks, //Rocks, usable in fights
throwing_ability,//Throwing ability 0-100
punch_ability, //Punching ability 0-100
kick_ability; //Kicking ability 0-100
char InterBBSMoves;
/*reserved for future use 3 bytes reset to 0*/
char res1;
int res2;
} user_rec;
#include "ibbsny.h"
/*
typedef struct {
char bbsname[36],
name[25];
guy_type nation;
int level,
rank;
unsigned long points,
money,
bank;
guy_status alive;
int days_not_on;
sex_type sex;
char say_win[41],
say_loose[41];
int turns,
hunger,
strength,
defense;
long hitpoints,
maxhitpoints;
weapon arm;
int condoms;
int since_got_laid;
int sex_today;
desease std;
int std_percent;
drug_type drug;
int drug_hits,
drug_addiction,
drug_high,
drug_days_since;
hotel_type rest_where;
unsigned char hotel_paid_fer,
days_in_hospital;
int res1,
res2,
res3,
res4,
res5;
} user_rec;*/